}
contract TryCatchTest {
ExchangeRates exchangeRates;
function convertINT2USD(uint INRvalue) public returns (bool)
{
try new ExchangeRates(INRvalue) {
return (true);
} catch Error(string memory) {
return (false);
} catch (bytes memory) {
return (false);
}
}
}
2.5.19 Events
Events are an abstraction on top of the Ethereum Virtual Machine’s
logging functionalities. They are especially useful for integration with
the frontend code. The front end code can work as an observer with
the call back functions waiting for a particular event to have
occurred. In the decentralized applications, events play a major role
in knowing the status of a transaction. For executing an event, we
must first declare an event, and then emit it with some useful data
that would be logged through them.
Refer to the following code:
//Declare an Event
eventEventName(address fromAddress,uintvalue);
//Emit an event
emit EventName(msg.sender,indexNumber);
The Application Binary Interface or ABI is a JSON artifact produced
by the Solidity compiler when compiling a smart contract. The ABI
defines the interface of a smart contract that may contain the
following: